
/*
 Navicat Premium Data Transfer

 Source Server         : 121.40.138.6_mongo
 Source Server Type    : MongoDB
 Source Server Version : 50003
 Source Host           : taotaoyongyuanbusi.top:27017
 Source Schema         : ems

 Target Server Type    : MongoDB
 Target Server Version : 50003
 File Encoding         : 65001

 Date: 11/11/2021 15:55:45
*/

// 测试mongo的neo查询 计算两个坐标点之间的距离 如果存放经纬度 则可以实现附近的人功能

// ----------------------------
// Collection structure for location
// ----------------------------
db.getCollection("location").drop();
db.createCollection("location");
db.getCollection("location").createIndex({
    loc: "2d"
}, {
    name: "loc",
    sparse: true
});

// ----------------------------
// Documents of location
// ----------------------------
db.getCollection("location").insert([ {
    _id: ObjectId("618cb2641c62cc0730004eb2"),
    name: "杨帅哥",
    address: "苏泊尔大厦",
    gender: 1,
    loc: [
        120.214567,
        30.212514
    ]
} ]);
db.getCollection("location").insert([ {
    _id: ObjectId("618cb2641c62cc0730004eb3"),
    name: "王美眉",
    address: "明豪大厦",
    gender: 0,
    loc: [
        120.214352,
        30.216915
    ]
} ]);
db.getCollection("location").insert([ {
    _id: ObjectId("618cb2641c62cc0730004eb4"),
    name: "张美眉",
    address: "汉氏大厦",
    gender: 0,
    loc: [
        120.211711,
        30.215136
    ]
} ]);
db.getCollection("location").insert([ {
    _id: ObjectId("618cb2641c62cc0730004eb5"),
    name: "李美眉",
    address: "网易大厦",
    gender: 0,
    loc: [
        120.197959,
        30.193491
    ]
} ]);
db.getCollection("location").insert([ {
    _id: ObjectId("618cb2641c62cc0730004eb6"),
    name: "彭美眉",
    address: "凯和大厦",
    gender: 0,
    loc: [
        120.179993,
        30.188122
    ]
} ]);
db.getCollection("location").insert([ {
    _id: ObjectId("618cb2641c62cc0730004eb7"),
    name: "赵美眉",
    address: "中兴通讯大厦",
    gender: 0,
    loc: [
        120.179275,
        30.163957
    ]
} ]);
db.getCollection("location").insert([ {
    _id: ObjectId("618cb2641c62cc0730004eb8"),
    name: "廖美眉",
    address: "江南商业大厦",
    gender: 0,
    loc: [
        120.152397,
        30.178694
    ]
} ]);
db.getCollection("location").insert([ {
    _id: ObjectId("618cb2641c62cc0730004eb9"),
    name: "余帅哥",
    address: "华创大厦",
    gender: 1,
    loc: [
        120.186263,
        30.193834
    ]
} ]);
db.getCollection("location").insert([ {
    _id: ObjectId("618cb2641c62cc0730004eba"),
    name: "吴帅哥",
    address: "远方大厦",
    gender: 1,
    loc: [
        120.191402,
        30.19321
    ]
} ]);
db.getCollection("location").insert([ {
    _id: ObjectId("618cb2641c62cc0730004ebb"),
    name: "何帅哥",
    address: "育德大厦",
    gender: 1,
    loc: [
        120.187647,
        30.200733
    ]
} ]);
